La gerarchia dei prompt: Dalle istruzioni alla logica
I prompt si sono evoluti da input basati su comandi semplici a architetture di ragionamento che guidano il percorso interno di elaborazione del modello.
Concetti fondamentali
- Prompting zero-shot: Fornire una descrizione del compito senza esempi (ad esempio, "Traduci questo in francese").
- Prompting few-shot: Usare le "dimostrazioni" (coppie input-uscita) per definire lo spazio delle etichette e il formato desiderato.
- Catena di pensiero (CoT): Una tecnica di prompt che incoraggia il modello a produrre passaggi intermedi di ragionamento.
- Proprietà emergenti: Il ragionamento complesso non è esplicitamente programmato, ma si "sviluppa" nei modelli con solitamente più di 10 miliardi di parametri.
Lo spostamento del ragionamento
- Seguimento di istruzioni: Mappatura diretta dell'input all'output.
- Apprendimento in contesto: Apprendere schemi dagli esempi forniti (few-shot).
- Decomposizione logica: Suddividere i problemi in passaggi sequenziali (CoT).
- Supervisione del processo: Dare prioritĂ all'accuratezza dei passaggi di "pensiero" rispetto alla risposta finale (come visto in OpenAI o1).
Idea chiave
Le prestazioni del modello in scenari few-shot sono molto sensibili alla distribuzione delle etichette e alla rilevanza delle dimostrazioni, piuttosto che semplicemente alla quantitĂ di esempi.
TERMINALbash — 80x24
> Ready. Click "Run" to execute.
>
Question 1
Which method relies on providing "demonstrations" to guide the model?
Question 2
True or False: Chain-of-Thought reasoning is a capability found in almost all AI models regardless of size.
Challenge: Optimizing Logic Puzzles
Scenario: Optimize a prompt for a model that is struggling with a logic puzzle.
You are using an LLM to solve the following puzzle: "A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost?"
Currently, you are passing the prompt exactly as written above, and the model incorrectly answers "$0.10".
Currently, you are passing the prompt exactly as written above, and the model incorrectly answers "$0.10".
Task 1
Identify if the current prompt is Zero-shot or Few-shot.
Solution:
The current prompt is Zero-shot because it provides the task description without any prior examples or demonstrations of similar solved puzzles.
The current prompt is Zero-shot because it provides the task description without any prior examples or demonstrations of similar solved puzzles.
Task 2
Inject the Zero-shot CoT trigger phrase to improve reasoning accuracy. Rewrite the prompt.
Solution:
"A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost? Let's think step by step:"
"A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost? Let's think step by step:"